<?php
/**
 * Desc:
 * User: yangyang
 * Date: 2024/4/8 15:33
 * Ver: 1.0
 */

namespace App\Transformers;

use App\Models\User;
use League\Fractal\TransformerAbstract;

class UserTransformer extends TransformerAbstract
{
    public function transform(User $user)
    {
        return [
            'id'    => $user->id,
            'name'  => $user->name,
            'email' => $user->email,
            'avatar' => $user->avatar,
            'avatar_url' => qiniu_url($user->avatar), // 获取头像地址'
            'phone' => $user->phone,
            'is_lock' => $user->is_locked,
            'created_at' => $user->created_at,
            'updated_at' => $user->updated_at,
        ];
    }
}
